<template>
  <div class="container">
    <div class="aside">
      <div class="greeting">
        <label>Hi</label>
        <p>你好！</p>
        <p>欢迎回家😀!</p>
      </div>
    </div>
    <div class="main">
        <div class="main_card" @click="goClick" v-for="item in this.familyData" >
          <img src="../../assets/images/house/house.png" alt="House Icon" class="main_card_image">
          <div>{{ item.familyName}}</div>
        </div>
    </div>
    <div class="family" v-on:click="gotoFamily">
      <=修改家庭信息
    </div>
  </div>

</template>

<script scoped>
import api from "@/api/family";

export default {
  name: "main",
  data() {
    return {
      familyData: {
        familyName:'',
        userId:'1'
      },
    };
  },
  mounted() {
    this.getAll()
  },
  methods: {
      getAll(){
        api.getAll().then((response)=>{
          if (response.code === 200) {
            this.familyData=response.data
          }else {
            this.$message(response.message);
          }
        })
      },
    goClick(){
      this.$router.push('/home')
    },
    gotoFamily(){
      this.$router.push('/family')
    }
  }
}
</script>

<style  scoped>
body, html {
  height: 100%;
  weight: 100%;
  margin: 0;
  font-family: Arial, sans-serif;
  background: url('../../assets/images/login/background.jpg') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  flex-direction: column;

}
.container{
  position: relative;
  width:100%;
  height: 100%;
}
.aside{
  background: transparent !important;
  height: 100%;
  width: 300px;
  position: absolute;
  left: 20px;
  top: 20px;
}
.main{
  background: transparent !important;
  height: 100%;
  width: 1200px;
  position: absolute;
  right: 20px;
  top: 20px;
  display: flex;
}
.greeting {
  font-size: 3em;
  color: white;
  text-align: left;
  margin-left: 5%;
  margin-top: 5%;
}
.greeting label{
  font-size: 2em;
}
.greeting p{
  margin-top: 40px;
  margin-bottom: 40px;
}

.main_card{
  width: 200px;
  height: 200px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  margin: 0 20px;
  text-align: center;
  padding: 0px;
  cursor: pointer;
}
.main_card_image{
  width: 80%; /* Adjust the size as needed */
  height: auto;
  margin-top: 10px;
}
.family{
  height: 30px;
  width: 300px;
  position: absolute;
  bottom: 10px;
  left: 20px;
  color: white;
  font-size: 19px;
  cursor: pointer;
}
</style>
